package com.wandian.notepad.adapter;


import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.notepad.R;
import com.wandian.notepad.bean.NoteTypeBean;

/**
 * NotepadClassifyManagerRecycleAdapter-适配器
 */
public class NotepadClassifyTypeRecycleAdapter extends BaseQuickAdapter<NoteTypeBean, BaseViewHolder> {

    public NotepadClassifyTypeRecycleAdapter(int layoutResId) {
        super(layoutResId);
    }
    public BtnClink dialogViewClink;

    public BtnClink getDialogViewClink() {
        return dialogViewClink;
    }

    public void setDialogViewClink(BtnClink dialogViewClink) {
        this.dialogViewClink = dialogViewClink;
    }

    public interface  BtnClink{
        void viewBtnClink(String id);
    }

    @Override
    protected void convert(BaseViewHolder helper, NoteTypeBean item) {

        helper.setText(R.id.tv_type_title, item.getType()+"");
        ImageView iv_edit = helper.getView(R.id.iv_edit);
        ImageView iv_delete = helper.getView(R.id.iv_delete);
        if(helper.getLayoutPosition()>3){
            iv_delete.setVisibility(View.VISIBLE);
            iv_edit.setVisibility(View.VISIBLE);
        }else {
            iv_delete.setVisibility(View.GONE);
            iv_edit.setVisibility(View.GONE);
        }
        iv_delete.setOnClickListener(v -> {
            if(helper.getLayoutPosition()>3){
                if(!UIUtils.isEmpty(dialogViewClink))dialogViewClink.viewBtnClink(item.getId()+"");
            }
        });

    }

}
